import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementUI from 'element-ui';
import axios from "axios";
import 'element-ui/lib/theme-chalk/index.css'
import VueCookies from 'vue-cookies'
import Contextmenu from "vue-contextmenujs"
import "v-contextmenu/dist/themes/default.css";
import VueContextMenu from 'vue-contextmenu'
import flexible from "lib-flexible-computer";

Vue.use(flexible);
Vue.use(VueContextMenu)
//鼠标右键插件
Vue.use(Contextmenu);

Vue.config.productionTip = false;
Vue.use(ElementUI);
Vue.prototype.$http =axios;
Vue.use(VueCookies);

// axios.defaults.withCredentials = true;
axios.defaults.baseURL = "http://192.168.0.67:9733";
//自动给同一个vue项目的所有请求添加请求头
// axios.interceptors.request.use(function (config) {
//   localStorage.setItem("authorization","admin:admin");
//   let token = localStorage.getItem('authorization');
//   if (token) {
//     // config.headers  ['Authorization'] = token;
//     config.headers.Authorization = token;
//   }
//
//   return config;
// })

// event Bus 用于无关系组件间的通信。
Vue.prototype.$bus = new Vue()

// axios.jsonp('http://localhost:8181/restconf/', {},
//     {
//       headers: {},
//       emulateJSON: true }).then((response) => {
//   this.movie = response.data;
//   console.log(this.movie);
// });
const vm =new Vue({
  router,
  store,
  mode: 'hash',
  render: h => h(App),
  //等价于以下代码
  // render(createElement){
  //   return createElement(App);
  // },
  // beforeMount() {
  //   this.prototype.$bus = this//全局事件总线
  // }
}).$mount('#app')
console.log(vm)